package com.sharemarking.application.common.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.sharemarking.application.common.BaseRepository;
import com.sharemarking.application.common.entity.Leave;
import com.sharemarking.application.common.entity.Room;

public interface RoomRepo extends BaseRepository<Room> {
	@Query("select name from Room where (startTime<?1 and endTime>?4) and ( (startTime>?2 and startTime<?3) or (startTime<=?2 and endTime>=?3) or (endTime>?2 and endTime<?3) )")
	List<String> findByTime(Date time1,Date time2,Date time3,Date time4);
	
	@Query("select name from Room where startTime>?1 and ( (startTime>?2 and startTime<?3) or (startTime<=?2 and endTime>=?3) or (endTime>?2 and endTime<?3) )")
	List<String> findByTime1(Date time1,Date time2,Date time3);
	
	List<Room> findByemployee_idOrderByUpdateDateDesc(Integer id);
}
